<HTML><HEAD><TITLE>?Term1 ~= ?Term2</TITLE>
</HEAD><BODY>[ <A HREF="index.html">Comparing and Sorting</A> | <A HREF="../../index.html">Reference Manual</A> | <A HREF="../../fullindex.html">Alphabetic Index</A> ]
<H1>?Term1 ~= ?Term2</H1>
The sound difference operator.  Succeeds if the two terms cannot be
unified, fails if they are identical, otherwise it delays.


<DL>
<DT><EM>Term1</EM></DT>
<DD>Any term.
</DD>
<DT><EM>Term2</EM></DT>
<DD>Any term.
</DD>
</DL>
<H2>Description</H2>
   If Term1 cannot be unified with Term2 it succeeds.  If the two terms are
   unifiable but not identical, the predicate delays since it cannot yet
   decide whether the terms are different or not.

<P>

<H3>Modes and Determinism</H3><UL>
<LI>~=(?, ?) is semidet
</UL>
<H3>Fail Conditions</H3>
Fails if Term1 and Term2 are identical in the sense of ==/2.
<H2>Examples</H2>
<PRE>
Success:
    3 ~= 4.
    3 ~= X,                (delays ...
        X = 4.             ... then succeeds and gives X = 4)

Note the nonlogical behaviour of negation as failure:
    3 \= X,                (fails ...
        X = 4.             ... and this is not recognized)

Fail:
    3 ~= 3.
    s(X,Y) ~= s(X,Y).
    s(X,Y) ~= s(X,Z),        (delays ...
         Z = Y.             ... then fails)



</PRE>
<H2>See Also</H2>
<A HREF="../../kernel/termcomp/RE-2.html">\= / 2</A>, <A HREF="../../kernel/termcomp/REE-2.html">\== / 2</A>, <A HREF="../../kernel/termcomp/EE-2.html">== / 2</A>, <A HREF="../../kernel/control/T-1.html">~ / 1</A>
</BODY></HTML>
